<?php
namespace Admin\Controller;
use Think\Controller;
class TongjiController extends CommonController {
    //柱状图
    public function echarts()
    {
        $time = strtotime("-7 days");

        //echo strtotime(date('Y-m-d',$time));

        $sql = "select count(id) cn,FROM_UNIXTIME(create_time,'%Y-%m-%d') cdate from user  GROUP BY cdate";

        $data = M()->query($sql);

        $cn = array();
        $cdate = array();
        foreach ($data as $v) {
            $cn[] = $v['cn'];
            $cdate[] = $v['cdate'];
        }

        $cn = implode(',', $cn);

        $cdate = implode('","', $cdate);
        //var_dump($cn,$cdate);

        $this->assign('cn',$cn);
        $this->assign('cdate',$cdate);


        $this->display();
    }
    public function reg()
    {
        $sql = "select count(id) cn,FROM_UNIXTIME(create_time,'%Y-%m-%d') cdate from user  GROUP BY cdate";

        $data = M()->query($sql);

        echo json_encode($data);
    }


	//拆线图
    public function echarts1()
    {

        $this->display();
    }

    //柱状图
    public function echarts2()
    {
    	$this->display();
    }
}